//
//  PushNewsCell.m
//  HYHOME
//
//  Created by cjy on 16/2/28.
//  Copyright © 2016年 Mac. All rights reserved.
//

#import "PushNewsCell.h"
#import "Model.h"
#import "UIImageView+WebCache.h"
#import "Taobao.h"
#import "DKNightVersion.h"


@implementation PushNewsCell

- (void)dealloc{


    [_cover_image_url release];
    [_price release];
    [_name release];
    [_description1 release];
    [super dealloc];

}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubview];
    }
    
    return self;
}
- (void)createSubview{

    
    self.cover_image_url = [[UIImageView alloc]init];
    [self.contentView addSubview:self.cover_image_url];
    
    
    self.description1  = [[UILabel alloc]init];
    [self.contentView addSubview:self.description1];
    
    self.name  = [[UILabel alloc]init];
    [self.contentView addSubview:self.name];
    
    self.price  = [[UILabel alloc]init];
    [self.contentView addSubview:self.price];
    
    
    
    
    
    
   

    [self.cover_image_url release];
    [self.description1 release];
    [self.name release];
    [self.price release];
    
    
    self.cover_image_url.userInteractionEnabled = YES;

    
}

- (void)layoutSubviews{
    
    [super layoutSubviews];
    
    self.cover_image_url.frame = CGRectMake(0, 0, self.contentView.frame.size.width, 300);
    self.name.frame = CGRectMake(10, 310, self.contentView.frame.size.width, 30);
    self.price.frame = CGRectMake(10, 350, self.contentView.frame.size.width / 2, 20);
    self.description1.frame = CGRectMake(10, 350, self.contentView.frame.size.width -20, 100);
    
  

}

- (void)passModel:(Model *)model{

    [self.cover_image_url sd_setImageWithURL:[NSURL URLWithString:model.cover_image_url]  placeholderImage:[UIImage imageNamed:@"jz"]];
    
    self.name.text = model.name;
    self.name.numberOfLines = 0;
    self.name.font = [UIFont boldSystemFontOfSize:20];
    self.name.text = [NSString stringWithFormat:@"%@",model.name];
    
    
    self.description1.text = [model.favorites_count stringValue];
    self.description1.text = [NSString stringWithFormat:@"%@",model.description1];
    
    self.description1.font = [UIFont systemFontOfSize:13];
    self.description1.numberOfLines = 0;
    
    self.price.font = [UIFont systemFontOfSize:15];
    
    self.price.text = model.price ;
    self.price.text = [NSString stringWithFormat:@"  ¥ %@",model.price];
    self.price.textColor = [UIColor redColor];
    
    
    self.name.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor lightGrayColor]);
    self.description1.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor lightGrayColor]);
    self.price.dk_textColorPicker = DKColorWithColors([UIColor redColor], [UIColor redColor]);



}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
